﻿@model IEnumerable<ETA.Entity.FlowLog>
@{
    ViewBag.Title = "个人用户通道";
    var currentIndex = -1;
    var previousIndex = -2;
    ETA.Entity.FlowLog currentStepInfo = null;
    ETA.Entity.FlowLog previousStepInfo = null;

    if (Model.Any())
    {
        var currentStep = Model.First().RegistrationMainForm.User.CurrentStep;
        if (currentStep != null)
        {
            currentIndex = currentStep.FlowIndex.Value;
            previousIndex = currentIndex - 1;
            currentStepInfo = Model.FirstOrDefault(r => r.FlowStepInfo.FlowIndex == currentIndex);//当前一步
            previousStepInfo = Model.FirstOrDefault(r => r.FlowStepInfo.FlowIndex == previousIndex);//上一步 
        }
    }
}

<div class="container">
    @if (previousIndex > 0 && previousStepInfo != null)
    { 
        <div class="stepUpDiv">
            <img src="~/Content/Image/Trainee/up.png" />
            <h3>已完成</h3>
            <div class="infoDetailOfT">
                <p>
                    <label>进度节点：</label><span>@previousStepInfo.FlowStepInfo.FlowStepName</span>
                </p>
                <p>
                    <label>完成时间：</label><span>@previousStepInfo.ModifyDate</span>
                </p>
            </div>
        </div>
    }
    else
    {
        <div class="stepUpDiv">
            <img src="~/Content/Image/Trainee/up.png" />
            <h3>已完成</h3>
        </div>
    }

    @if (currentIndex > 1 && currentStepInfo != null)
    {
        var sdate = string.Empty;
        var edate = string.Empty;
        var messageContent = string.Empty;
        ETA.Entity.WebMessage message = null;
        var stepUrl = "#";
        stepUrl = currentStepInfo.FlowStepInfo.StepLink;
        if (currentStepInfo.WebMessages != null)
        {
            message = currentStepInfo.WebMessages.FirstOrDefault();
        }
        if (message != null)
        {
            sdate = message.SDate.Value.ToShortDateString();
            edate = message.EDate.Value.ToShortDateString();
            messageContent = message.Content;
        }
        <div class="stepDownDiv">
            <img src="~/Content/Image/Trainee/down.png" />
            <h3>下一步</h3>
            <div class="infoDetailOfT">
                <p>
                    <label>进度节点：</label><span>@currentStepInfo.FlowStepInfo.FlowStepName</span>
                </p>
                <p>
                    <label>起止时间：</label><span>@sdate ~ @edate</span>
                </p>
                <p>
                    <label>消息通知：</label><span>@messageContent</span>
                </p>
                <p><a href="@stepUrl" class="btn btn-default">下一步</a></p>
            </div>

        </div>
    }
    else
    {
        <div class="stepDownDiv">
            <img src="~/Content/Image/Trainee/down.png" />
            <h3>下一步</h3>
            <div class="infoDetailOfT">
                <p>
                    <label>进度节点：</label><span>赴日技能实习生登记表</span>
                </p>
                <p>
                    <label>起止时间：</label><span></span>
                </p>
                <p>
                    <label>消息通知：</label><span>请完成《赴日技能实习生登记表》的填写，出国快车会在审核后通过网站或APP的站内消息通知到您，以便完成下一步的操作。</span>
                </p>
                <p><a href="/Trainee/FillRegistrationForm" class="btn btn-default">下一步</a></p>
            </div>
        </div>
    }
</div>

